﻿<!DOCTYPE html>
<html>
<head>
    <title>CGI</title>
</head>
<body>
    <h1>Our Page</h1>
    <!--01 global function-->
    <script>
        function printOrder() {
            console.log('Printing order.');
        };
        printOrder();
    </script>
    <!--02 declare the function after calling it-->
    <!--<script>
        printOrder('9002');
        function printOrder(orderId) {
            console.log('Printing order: ' + orderId);
        };
    </script>-->
    <!--03-->
    <!--<script>
        function calcTotalPrice(quantity, price, currency) {
            console.log(currency);
        };
        calcTotalPrice(2, 4.00);
    </script>-->
    <!--04 assign function call to a variable through return-->
    <!--<script>
        function calcTotalPrice(quantity, price) {
            return quantity * price;
        };
        var totalPrice = calcTotalPrice(2, 4.00);
        console.log(totalPrice);
    </script>-->
    <!--05-->
    <!--<script>
        function calcTotalPrice(quantity, price) {
            return quantity * price;
        };
        var totalPrice = calcTotalPrice(2, 4.00);
        console.log(totalPrice);
        totalPrice = calcTotalPrice(3, 3.00);
        console.log(totalPrice);
    </script>-->
    <!--06undefined, if function doesn't return a value-->
    <!--<script>
        function getOrder() {
            // nothing returned
        };
        var order = getOrder();
        console.log(order);

    </script>-->
    <!--07 function expression-->
    <!--asssign function to variable, function doesn't have name, anonymous.-->
    <!--<script>
        var activateOrder= function() {
            console.log('Order activated.');
        };
        console.log(typeof activateOrder);
        activateOrder();
    </script>-->
    <!--08-->
    <!--<script>
        var activateOrder = function () {
            console.log('Order activated.');
        };
        activateOrder;
    </script>-->
</body>
</html>